package com.sailfish.springbootdemo.dao.db8;


import com.sailfish.springbootdemo.common.DB8TableName;
import com.sailfish.springbootdemo.pojo.db8.vVplPartData;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface vVplPartDataDao {

    @Select("<script>" +
            " select " +
            " * " +
            " from " + DB8TableName.V_VPL_PARTDATA + " " +
            " where deleted='0' and  code = #{code} and manufacturer_type = #{manufacturer_type}" +
            "</script>"
    )
    List<vVplPartData> getvVplPartData(@Param("code") String code,
                                       @Param("manufacturer_type") String manufacturer_type);

    @Select("<script>" +
            " select " +
            " * " +
            " from " + DB8TableName.V_VPL_PARTDATA + " " +
            " where deleted='0' " +
            "</script>"
    )
    List<vVplPartData> getvVplPartDataAll();

    @Select("<script>" +
            " select " +
            " * " +
            " from " + DB8TableName.V_VPL_PARTDATA + " " +
            " where  deleted='0' and code = #{code}" +
            "</script>"
    )
    List<vVplPartData> getvVplPartDataByCode(@Param("code") String code);

    @Select("<script>" +
            "SELECT * FROM " + DB8TableName.V_VPL_PARTDATA +
            " WHERE deleted = '0'" +
            "<if test='codes != null and codes.size() > 0'>" +
            " AND code IN" +
            "<foreach item='code' collection='codes' open='(' separator=',' close=')'>" +
            "#{code}" +
            "</foreach>" +
            "</if>" +
            "</script>")
    List<vVplPartData> getvVplPartDataByCodes(@Param("codes") List<String> codes);
}
